package com.itheima.controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
@AllArgsConstructor
public class ReportController {

    private ReportService reportService;
    @GetMapping("empJobData")
    public Result getEmpJobData(){
        log.info("查询员工岗位统计数据");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("empGenderData")
    public Result getEmpGenderData(){
        log.info("查询员工性别统计数据");
        List<Map<String, Object>> dataList = reportService.getEmpGenderData();
        return Result.success(dataList);
    }

    @GetMapping("studentCountData")
    public Result getStudentCountData(){
        log.info("查询班级学生数量统计数据");
        ClazzOption clazzOption = reportService.getStudentCountData();
        return Result.success(clazzOption);
    }

    @GetMapping("studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("查询学生学历统计数据");
        List<Map<String, Object>> dataList = reportService.getStudentDegreeData();
        return Result.success(dataList);
    }
}
